﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using hsgsSHXX.DBUtility;//Please add references
using System.Collections.Generic;
namespace hsgsSHXX.DAL
{
	/// <summary>
	/// 数据访问类:jkda
	/// </summary>
	public partial class jkda
	{
		public jkda()
		{}
		#region  Method



		/// <summary>
		/// 增加一条数据
		/// </summary>
		public bool Add(hsgsSHXX.Model.jkda model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into jkda(");
			strSql.Append("ID,dabh,jtbh,xm,xb,csrq,xx,lxlb,lxfs,hy,zy,whcd,gzdw,yhzgx,zjlx,zjhm,sfzh,bxlb,bxh,jzdzs,jzdzs1,jzdzx,jzdzjdz,jzdzsqc,xqlm,nm,hm,fjm,字段28,zrys,jdr,jdjg,gljg,glfwz,jdsj,dazt,daly)");
			strSql.Append(" values (");
			strSql.Append("@ID,@dabh,@jtbh,@xm,@xb,@csrq,@xx,@lxlb,@lxfs,@hy,@zy,@whcd,@gzdw,@yhzgx,@zjlx,@zjhm,@sfzh,@bxlb,@bxh,@jzdzs,@jzdzs1,@jzdzx,@jzdzjdz,@jzdzsqc,@xqlm,@nm,@hm,@fjm,@字段28,@zrys,@jdr,@jdjg,@gljg,@glfwz,@jdsj,@dazt,@daly)");
			SqlParameter[] parameters = {
					new SqlParameter("@ID", SqlDbType.Int,4),
					new SqlParameter("@dabh", SqlDbType.NVarChar,255),
					new SqlParameter("@jtbh", SqlDbType.NVarChar,255),
					new SqlParameter("@xm", SqlDbType.NVarChar,255),
					new SqlParameter("@xb", SqlDbType.NVarChar,255),
					new SqlParameter("@csrq", SqlDbType.DateTime),
					new SqlParameter("@xx", SqlDbType.NVarChar,255),
					new SqlParameter("@lxlb", SqlDbType.NVarChar,255),
					new SqlParameter("@lxfs", SqlDbType.NVarChar,255),
					new SqlParameter("@hy", SqlDbType.NVarChar,255),
					new SqlParameter("@zy", SqlDbType.NVarChar,255),
					new SqlParameter("@whcd", SqlDbType.NVarChar,255),
					new SqlParameter("@gzdw", SqlDbType.NVarChar,255),
					new SqlParameter("@yhzgx", SqlDbType.NVarChar,255),
					new SqlParameter("@zjlx", SqlDbType.NVarChar,255),
					new SqlParameter("@zjhm", SqlDbType.NVarChar,255),
					new SqlParameter("@sfzh", SqlDbType.NVarChar,255),
					new SqlParameter("@bxlb", SqlDbType.NVarChar,255),
					new SqlParameter("@bxh", SqlDbType.NVarChar,255),
					new SqlParameter("@jzdzs", SqlDbType.NVarChar,255),
					new SqlParameter("@jzdzs1", SqlDbType.NVarChar,255),
					new SqlParameter("@jzdzx", SqlDbType.NVarChar,255),
					new SqlParameter("@jzdzjdz", SqlDbType.NVarChar,255),
					new SqlParameter("@jzdzsqc", SqlDbType.NVarChar,255),
					new SqlParameter("@xqlm", SqlDbType.NVarChar,255),
					new SqlParameter("@nm", SqlDbType.NVarChar,255),
					new SqlParameter("@hm", SqlDbType.NVarChar,255),
					new SqlParameter("@fjm", SqlDbType.NVarChar,255),
					new SqlParameter("@字段28", SqlDbType.Int,4),
					new SqlParameter("@zrys", SqlDbType.NVarChar,255),
					new SqlParameter("@jdr", SqlDbType.NVarChar,255),
					new SqlParameter("@jdjg", SqlDbType.NVarChar,255),
					new SqlParameter("@gljg", SqlDbType.NVarChar,255),
					new SqlParameter("@glfwz", SqlDbType.NVarChar,255),
					new SqlParameter("@jdsj", SqlDbType.DateTime),
					new SqlParameter("@dazt", SqlDbType.NVarChar,255),
					new SqlParameter("@daly", SqlDbType.NVarChar,255)};
			parameters[0].Value = model.ID;
			parameters[1].Value = model.dabh;
			parameters[2].Value = model.jtbh;
			parameters[3].Value = model.xm;
			parameters[4].Value = model.xb;
			parameters[5].Value = model.csrq;
			parameters[6].Value = model.xx;
			parameters[7].Value = model.lxlb;
			parameters[8].Value = model.lxfs;
			parameters[9].Value = model.hy;
			parameters[10].Value = model.zy;
			parameters[11].Value = model.whcd;
			parameters[12].Value = model.gzdw;
			parameters[13].Value = model.yhzgx;
			parameters[14].Value = model.zjlx;
			parameters[15].Value = model.zjhm;
			parameters[16].Value = model.sfzh;
			parameters[17].Value = model.bxlb;
			parameters[18].Value = model.bxh;
			parameters[19].Value = model.jzdzs;
			parameters[20].Value = model.jzdzs1;
			parameters[21].Value = model.jzdzx;
			parameters[22].Value = model.jzdzjdz;
			parameters[23].Value = model.jzdzsqc;
			parameters[24].Value = model.xqlm;
			parameters[25].Value = model.nm;
			parameters[26].Value = model.hm;
			parameters[27].Value = model.fjm;
			parameters[28].Value = model.字段28;
			parameters[29].Value = model.zrys;
			parameters[30].Value = model.jdr;
			parameters[31].Value = model.jdjg;
			parameters[32].Value = model.gljg;
			parameters[33].Value = model.glfwz;
			parameters[34].Value = model.jdsj;
			parameters[35].Value = model.dazt;
			parameters[36].Value = model.daly;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(hsgsSHXX.Model.jkda model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update jkda set ");
			strSql.Append("ID=@ID,");
			strSql.Append("dabh=@dabh,");
			strSql.Append("jtbh=@jtbh,");
			strSql.Append("xm=@xm,");
			strSql.Append("xb=@xb,");
			strSql.Append("csrq=@csrq,");
			strSql.Append("xx=@xx,");
			strSql.Append("lxlb=@lxlb,");
			strSql.Append("lxfs=@lxfs,");
			strSql.Append("hy=@hy,");
			strSql.Append("zy=@zy,");
			strSql.Append("whcd=@whcd,");
			strSql.Append("gzdw=@gzdw,");
			strSql.Append("yhzgx=@yhzgx,");
			strSql.Append("zjlx=@zjlx,");
			strSql.Append("zjhm=@zjhm,");
			strSql.Append("sfzh=@sfzh,");
			strSql.Append("bxlb=@bxlb,");
			strSql.Append("bxh=@bxh,");
			strSql.Append("jzdzs=@jzdzs,");
			strSql.Append("jzdzs1=@jzdzs1,");
			strSql.Append("jzdzx=@jzdzx,");
			strSql.Append("jzdzjdz=@jzdzjdz,");
			strSql.Append("jzdzsqc=@jzdzsqc,");
			strSql.Append("xqlm=@xqlm,");
			strSql.Append("nm=@nm,");
			strSql.Append("hm=@hm,");
			strSql.Append("fjm=@fjm,");
			strSql.Append("字段28=@字段28,");
			strSql.Append("zrys=@zrys,");
			strSql.Append("jdr=@jdr,");
			strSql.Append("jdjg=@jdjg,");
			strSql.Append("gljg=@gljg,");
			strSql.Append("glfwz=@glfwz,");
			strSql.Append("jdsj=@jdsj,");
			strSql.Append("dazt=@dazt,");
			strSql.Append("daly=@daly");
			strSql.Append(" where ");
			SqlParameter[] parameters = {
					new SqlParameter("@ID", SqlDbType.Int,4),
					new SqlParameter("@dabh", SqlDbType.NVarChar,255),
					new SqlParameter("@jtbh", SqlDbType.NVarChar,255),
					new SqlParameter("@xm", SqlDbType.NVarChar,255),
					new SqlParameter("@xb", SqlDbType.NVarChar,255),
					new SqlParameter("@csrq", SqlDbType.DateTime),
					new SqlParameter("@xx", SqlDbType.NVarChar,255),
					new SqlParameter("@lxlb", SqlDbType.NVarChar,255),
					new SqlParameter("@lxfs", SqlDbType.NVarChar,255),
					new SqlParameter("@hy", SqlDbType.NVarChar,255),
					new SqlParameter("@zy", SqlDbType.NVarChar,255),
					new SqlParameter("@whcd", SqlDbType.NVarChar,255),
					new SqlParameter("@gzdw", SqlDbType.NVarChar,255),
					new SqlParameter("@yhzgx", SqlDbType.NVarChar,255),
					new SqlParameter("@zjlx", SqlDbType.NVarChar,255),
					new SqlParameter("@zjhm", SqlDbType.NVarChar,255),
					new SqlParameter("@sfzh", SqlDbType.NVarChar,255),
					new SqlParameter("@bxlb", SqlDbType.NVarChar,255),
					new SqlParameter("@bxh", SqlDbType.NVarChar,255),
					new SqlParameter("@jzdzs", SqlDbType.NVarChar,255),
					new SqlParameter("@jzdzs1", SqlDbType.NVarChar,255),
					new SqlParameter("@jzdzx", SqlDbType.NVarChar,255),
					new SqlParameter("@jzdzjdz", SqlDbType.NVarChar,255),
					new SqlParameter("@jzdzsqc", SqlDbType.NVarChar,255),
					new SqlParameter("@xqlm", SqlDbType.NVarChar,255),
					new SqlParameter("@nm", SqlDbType.NVarChar,255),
					new SqlParameter("@hm", SqlDbType.NVarChar,255),
					new SqlParameter("@fjm", SqlDbType.NVarChar,255),
					new SqlParameter("@字段28", SqlDbType.Int,4),
					new SqlParameter("@zrys", SqlDbType.NVarChar,255),
					new SqlParameter("@jdr", SqlDbType.NVarChar,255),
					new SqlParameter("@jdjg", SqlDbType.NVarChar,255),
					new SqlParameter("@gljg", SqlDbType.NVarChar,255),
					new SqlParameter("@glfwz", SqlDbType.NVarChar,255),
					new SqlParameter("@jdsj", SqlDbType.DateTime),
					new SqlParameter("@dazt", SqlDbType.NVarChar,255),
					new SqlParameter("@daly", SqlDbType.NVarChar,255)};
			parameters[0].Value = model.ID;
			parameters[1].Value = model.dabh;
			parameters[2].Value = model.jtbh;
			parameters[3].Value = model.xm;
			parameters[4].Value = model.xb;
			parameters[5].Value = model.csrq;
			parameters[6].Value = model.xx;
			parameters[7].Value = model.lxlb;
			parameters[8].Value = model.lxfs;
			parameters[9].Value = model.hy;
			parameters[10].Value = model.zy;
			parameters[11].Value = model.whcd;
			parameters[12].Value = model.gzdw;
			parameters[13].Value = model.yhzgx;
			parameters[14].Value = model.zjlx;
			parameters[15].Value = model.zjhm;
			parameters[16].Value = model.sfzh;
			parameters[17].Value = model.bxlb;
			parameters[18].Value = model.bxh;
			parameters[19].Value = model.jzdzs;
			parameters[20].Value = model.jzdzs1;
			parameters[21].Value = model.jzdzx;
			parameters[22].Value = model.jzdzjdz;
			parameters[23].Value = model.jzdzsqc;
			parameters[24].Value = model.xqlm;
			parameters[25].Value = model.nm;
			parameters[26].Value = model.hm;
			parameters[27].Value = model.fjm;
			parameters[28].Value = model.字段28;
			parameters[29].Value = model.zrys;
			parameters[30].Value = model.jdr;
			parameters[31].Value = model.jdjg;
			parameters[32].Value = model.gljg;
			parameters[33].Value = model.glfwz;
			parameters[34].Value = model.jdsj;
			parameters[35].Value = model.dazt;
			parameters[36].Value = model.daly;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete()
		{
			//该表无主键信息，请自定义主键/条件字段
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from jkda ");
			strSql.Append(" where ");
			SqlParameter[] parameters = {
};

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public hsgsSHXX.Model.jkda GetModel()
		{
			//该表无主键信息，请自定义主键/条件字段
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 ID,dabh,jtbh,xm,xb,csrq,xx,lxlb,lxfs,hy,zy,whcd,gzdw,yhzgx,zjlx,zjhm,sfzh,bxlb,bxh,jzdzs,jzdzs1,jzdzx,jzdzjdz,jzdzsqc,xqlm,nm,hm,fjm,字段28,zrys,jdr,jdjg,gljg,glfwz,jdsj,dazt,daly from jkda ");
			strSql.Append(" where ");
			SqlParameter[] parameters = {
};

			hsgsSHXX.Model.jkda model=new hsgsSHXX.Model.jkda();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				if(ds.Tables[0].Rows[0]["ID"]!=null && ds.Tables[0].Rows[0]["ID"].ToString()!="")
				{
					model.ID=int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
				}
				if(ds.Tables[0].Rows[0]["dabh"]!=null && ds.Tables[0].Rows[0]["dabh"].ToString()!="")
				{
					model.dabh=ds.Tables[0].Rows[0]["dabh"].ToString();
				}
				if(ds.Tables[0].Rows[0]["jtbh"]!=null && ds.Tables[0].Rows[0]["jtbh"].ToString()!="")
				{
					model.jtbh=ds.Tables[0].Rows[0]["jtbh"].ToString();
				}
				if(ds.Tables[0].Rows[0]["xm"]!=null && ds.Tables[0].Rows[0]["xm"].ToString()!="")
				{
					model.xm=ds.Tables[0].Rows[0]["xm"].ToString();
				}
				if(ds.Tables[0].Rows[0]["xb"]!=null && ds.Tables[0].Rows[0]["xb"].ToString()!="")
				{
					model.xb=ds.Tables[0].Rows[0]["xb"].ToString();
				}
				if(ds.Tables[0].Rows[0]["csrq"]!=null && ds.Tables[0].Rows[0]["csrq"].ToString()!="")
				{
					model.csrq=DateTime.Parse(ds.Tables[0].Rows[0]["csrq"].ToString());
				}
				if(ds.Tables[0].Rows[0]["xx"]!=null && ds.Tables[0].Rows[0]["xx"].ToString()!="")
				{
					model.xx=ds.Tables[0].Rows[0]["xx"].ToString();
				}
				if(ds.Tables[0].Rows[0]["lxlb"]!=null && ds.Tables[0].Rows[0]["lxlb"].ToString()!="")
				{
					model.lxlb=ds.Tables[0].Rows[0]["lxlb"].ToString();
				}
				if(ds.Tables[0].Rows[0]["lxfs"]!=null && ds.Tables[0].Rows[0]["lxfs"].ToString()!="")
				{
					model.lxfs=ds.Tables[0].Rows[0]["lxfs"].ToString();
				}
				if(ds.Tables[0].Rows[0]["hy"]!=null && ds.Tables[0].Rows[0]["hy"].ToString()!="")
				{
					model.hy=ds.Tables[0].Rows[0]["hy"].ToString();
				}
				if(ds.Tables[0].Rows[0]["zy"]!=null && ds.Tables[0].Rows[0]["zy"].ToString()!="")
				{
					model.zy=ds.Tables[0].Rows[0]["zy"].ToString();
				}
				if(ds.Tables[0].Rows[0]["whcd"]!=null && ds.Tables[0].Rows[0]["whcd"].ToString()!="")
				{
					model.whcd=ds.Tables[0].Rows[0]["whcd"].ToString();
				}
				if(ds.Tables[0].Rows[0]["gzdw"]!=null && ds.Tables[0].Rows[0]["gzdw"].ToString()!="")
				{
					model.gzdw=ds.Tables[0].Rows[0]["gzdw"].ToString();
				}
				if(ds.Tables[0].Rows[0]["yhzgx"]!=null && ds.Tables[0].Rows[0]["yhzgx"].ToString()!="")
				{
					model.yhzgx=ds.Tables[0].Rows[0]["yhzgx"].ToString();
				}
				if(ds.Tables[0].Rows[0]["zjlx"]!=null && ds.Tables[0].Rows[0]["zjlx"].ToString()!="")
				{
					model.zjlx=ds.Tables[0].Rows[0]["zjlx"].ToString();
				}
				if(ds.Tables[0].Rows[0]["zjhm"]!=null && ds.Tables[0].Rows[0]["zjhm"].ToString()!="")
				{
					model.zjhm=ds.Tables[0].Rows[0]["zjhm"].ToString();
				}
				if(ds.Tables[0].Rows[0]["sfzh"]!=null && ds.Tables[0].Rows[0]["sfzh"].ToString()!="")
				{
					model.sfzh=ds.Tables[0].Rows[0]["sfzh"].ToString();
				}
				if(ds.Tables[0].Rows[0]["bxlb"]!=null && ds.Tables[0].Rows[0]["bxlb"].ToString()!="")
				{
					model.bxlb=ds.Tables[0].Rows[0]["bxlb"].ToString();
				}
				if(ds.Tables[0].Rows[0]["bxh"]!=null && ds.Tables[0].Rows[0]["bxh"].ToString()!="")
				{
					model.bxh=ds.Tables[0].Rows[0]["bxh"].ToString();
				}
				if(ds.Tables[0].Rows[0]["jzdzs"]!=null && ds.Tables[0].Rows[0]["jzdzs"].ToString()!="")
				{
					model.jzdzs=ds.Tables[0].Rows[0]["jzdzs"].ToString();
				}
				if(ds.Tables[0].Rows[0]["jzdzs1"]!=null && ds.Tables[0].Rows[0]["jzdzs1"].ToString()!="")
				{
					model.jzdzs1=ds.Tables[0].Rows[0]["jzdzs1"].ToString();
				}
				if(ds.Tables[0].Rows[0]["jzdzx"]!=null && ds.Tables[0].Rows[0]["jzdzx"].ToString()!="")
				{
					model.jzdzx=ds.Tables[0].Rows[0]["jzdzx"].ToString();
				}
				if(ds.Tables[0].Rows[0]["jzdzjdz"]!=null && ds.Tables[0].Rows[0]["jzdzjdz"].ToString()!="")
				{
					model.jzdzjdz=ds.Tables[0].Rows[0]["jzdzjdz"].ToString();
				}
				if(ds.Tables[0].Rows[0]["jzdzsqc"]!=null && ds.Tables[0].Rows[0]["jzdzsqc"].ToString()!="")
				{
					model.jzdzsqc=ds.Tables[0].Rows[0]["jzdzsqc"].ToString();
				}
				if(ds.Tables[0].Rows[0]["xqlm"]!=null && ds.Tables[0].Rows[0]["xqlm"].ToString()!="")
				{
					model.xqlm=ds.Tables[0].Rows[0]["xqlm"].ToString();
				}
				if(ds.Tables[0].Rows[0]["nm"]!=null && ds.Tables[0].Rows[0]["nm"].ToString()!="")
				{
					model.nm=ds.Tables[0].Rows[0]["nm"].ToString();
				}
				if(ds.Tables[0].Rows[0]["hm"]!=null && ds.Tables[0].Rows[0]["hm"].ToString()!="")
				{
					model.hm=ds.Tables[0].Rows[0]["hm"].ToString();
				}
				if(ds.Tables[0].Rows[0]["fjm"]!=null && ds.Tables[0].Rows[0]["fjm"].ToString()!="")
				{
					model.fjm=ds.Tables[0].Rows[0]["fjm"].ToString();
				}
				if(ds.Tables[0].Rows[0]["字段28"]!=null && ds.Tables[0].Rows[0]["字段28"].ToString()!="")
				{
					model.字段28=int.Parse(ds.Tables[0].Rows[0]["字段28"].ToString());
				}
				if(ds.Tables[0].Rows[0]["zrys"]!=null && ds.Tables[0].Rows[0]["zrys"].ToString()!="")
				{
					model.zrys=ds.Tables[0].Rows[0]["zrys"].ToString();
				}
				if(ds.Tables[0].Rows[0]["jdr"]!=null && ds.Tables[0].Rows[0]["jdr"].ToString()!="")
				{
					model.jdr=ds.Tables[0].Rows[0]["jdr"].ToString();
				}
				if(ds.Tables[0].Rows[0]["jdjg"]!=null && ds.Tables[0].Rows[0]["jdjg"].ToString()!="")
				{
					model.jdjg=ds.Tables[0].Rows[0]["jdjg"].ToString();
				}
				if(ds.Tables[0].Rows[0]["gljg"]!=null && ds.Tables[0].Rows[0]["gljg"].ToString()!="")
				{
					model.gljg=ds.Tables[0].Rows[0]["gljg"].ToString();
				}
				if(ds.Tables[0].Rows[0]["glfwz"]!=null && ds.Tables[0].Rows[0]["glfwz"].ToString()!="")
				{
					model.glfwz=ds.Tables[0].Rows[0]["glfwz"].ToString();
				}
				if(ds.Tables[0].Rows[0]["jdsj"]!=null && ds.Tables[0].Rows[0]["jdsj"].ToString()!="")
				{
					model.jdsj=DateTime.Parse(ds.Tables[0].Rows[0]["jdsj"].ToString());
				}
				if(ds.Tables[0].Rows[0]["dazt"]!=null && ds.Tables[0].Rows[0]["dazt"].ToString()!="")
				{
					model.dazt=ds.Tables[0].Rows[0]["dazt"].ToString();
				}
				if(ds.Tables[0].Rows[0]["daly"]!=null && ds.Tables[0].Rows[0]["daly"].ToString()!="")
				{
					model.daly=ds.Tables[0].Rows[0]["daly"].ToString();
				}
				return model;
			}
			else
			{
				return null;
			}
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ID,dabh,jtbh,xm,xb,csrq,xx,lxlb,lxfs,hy,zy,whcd,gzdw,yhzgx,zjlx,zjhm,sfzh,bxlb,bxh,jzdzs,jzdzs1,jzdzx,jzdzjdz,jzdzsqc,xqlm,nm,hm,fjm,字段28,zrys,jdr,jdjg,gljg,glfwz,jdsj,dazt,daly ");
			strSql.Append(" FROM jkda ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" ID,dabh,jtbh,xm,xb,csrq,xx,lxlb,lxfs,hy,zy,whcd,gzdw,yhzgx,zjlx,zjhm,sfzh,bxlb,bxh,jzdzs,jzdzs1,jzdzx,jzdzjdz,jzdzsqc,xqlm,nm,hm,fjm,字段28,zrys,jdr,jdjg,gljg,glfwz,jdsj,dazt,daly ");
			strSql.Append(" FROM jkda ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获取记录总数
		/// </summary>
		public int GetRecordCount(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) FROM jkda ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			object obj = DbHelperSQL.GetSingle(strSql.ToString());
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("SELECT * FROM ( ");
			strSql.Append(" SELECT ROW_NUMBER() OVER (");
			if (!string.IsNullOrEmpty(orderby.Trim()))
			{
				strSql.Append("order by T." + orderby );
			}
			else
			{
				strSql.Append("order by T. desc");
			}
			strSql.Append(")AS Row, T.*  from jkda T ");
			if (!string.IsNullOrEmpty(strWhere.Trim()))
			{
				strSql.Append(" WHERE " + strWhere);
			}
			strSql.Append(" ) TT");
			strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/*
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
					new SqlParameter("@PageSize", SqlDbType.Int),
					new SqlParameter("@PageIndex", SqlDbType.Int),
					new SqlParameter("@IsReCount", SqlDbType.Bit),
					new SqlParameter("@OrderType", SqlDbType.Bit),
					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
					};
			parameters[0].Value = "jkda";
			parameters[1].Value = "";
			parameters[2].Value = PageSize;
			parameters[3].Value = PageIndex;
			parameters[4].Value = 0;
			parameters[5].Value = 0;
			parameters[6].Value = strWhere;	
			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
		}*/
        public List<Model.jkda> GetFondListByPage(int pageSize, int pageIndex, string strWhere, string fOrderFiled, out int total)
        {
            if (fOrderFiled == "")
            {
                fOrderFiled = "ID desc";
            }
            SqlParameter[] parameters = {  
                    new SqlParameter("@tableName", SqlDbType.VarChar, 50),  
                    new SqlParameter("@fields", SqlDbType.VarChar, 2000),  
                    new SqlParameter("@orderField", SqlDbType.VarChar, 500),  
                    new SqlParameter("@sqlWhere", SqlDbType.VarChar,2000),  
                    new SqlParameter("@pageSize", SqlDbType.Int),  
                    new SqlParameter("@pageIndex", SqlDbType.Int),  
                    new SqlParameter("@TotalPage", SqlDbType.Int),
                    new SqlParameter("@TotalRecordCount", SqlDbType.Int) 
                    };

            parameters[0].Value = "jkda";
            parameters[1].Value = "*";
            parameters[2].Value = fOrderFiled;
            parameters[3].Value = strWhere;
            parameters[4].Value = pageSize;
            parameters[5].Value = pageIndex;
            parameters[6].Direction = ParameterDirection.Output;
            parameters[7].Direction = ParameterDirection.Output;
            DataSet ds = DbHelperSQL.RunProcedure("up_GetRecordByPage", parameters, "ds", 60 * 30);
            total = int.Parse(parameters[7].Value.ToString());
            return DataTableToList(ds.Tables[0]);

        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<hsgsSHXX.Model.jkda> DataTableToList(DataTable dt)
        {
            List<hsgsSHXX.Model.jkda> modelList = new List<hsgsSHXX.Model.jkda>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                hsgsSHXX.Model.jkda model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new hsgsSHXX.Model.jkda();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["dabh"] != null && dt.Rows[n]["dabh"].ToString() != "")
                    {
                        model.dabh = dt.Rows[n]["dabh"].ToString();
                    }
                    if (dt.Rows[n]["jtbh"] != null && dt.Rows[n]["jtbh"].ToString() != "")
                    {
                        model.jtbh = dt.Rows[n]["jtbh"].ToString();
                    }
                    if (dt.Rows[n]["xm"] != null && dt.Rows[n]["xm"].ToString() != "")
                    {
                        model.xm = dt.Rows[n]["xm"].ToString();
                    }
                    if (dt.Rows[n]["xb"] != null && dt.Rows[n]["xb"].ToString() != "")
                    {
                        model.xb = dt.Rows[n]["xb"].ToString();
                    }
                    if (dt.Rows[n]["csrq"] != null && dt.Rows[n]["csrq"].ToString() != "")
                    {
                        model.csrq = DateTime.Parse(dt.Rows[n]["csrq"].ToString());
                    }
                    if (dt.Rows[n]["xx"] != null && dt.Rows[n]["xx"].ToString() != "")
                    {
                        model.xx = dt.Rows[n]["xx"].ToString();
                    }
                    if (dt.Rows[n]["lxlb"] != null && dt.Rows[n]["lxlb"].ToString() != "")
                    {
                        model.lxlb = dt.Rows[n]["lxlb"].ToString();
                    }
                    if (dt.Rows[n]["lxfs"] != null && dt.Rows[n]["lxfs"].ToString() != "")
                    {
                        model.lxfs = dt.Rows[n]["lxfs"].ToString();
                    }
                    if (dt.Rows[n]["hy"] != null && dt.Rows[n]["hy"].ToString() != "")
                    {
                        model.hy = dt.Rows[n]["hy"].ToString();
                    }
                    if (dt.Rows[n]["zy"] != null && dt.Rows[n]["zy"].ToString() != "")
                    {
                        model.zy = dt.Rows[n]["zy"].ToString();
                    }
                    if (dt.Rows[n]["whcd"] != null && dt.Rows[n]["whcd"].ToString() != "")
                    {
                        model.whcd = dt.Rows[n]["whcd"].ToString();
                    }
                    if (dt.Rows[n]["gzdw"] != null && dt.Rows[n]["gzdw"].ToString() != "")
                    {
                        model.gzdw = dt.Rows[n]["gzdw"].ToString();
                    }
                    if (dt.Rows[n]["yhzgx"] != null && dt.Rows[n]["yhzgx"].ToString() != "")
                    {
                        model.yhzgx = dt.Rows[n]["yhzgx"].ToString();
                    }
                    if (dt.Rows[n]["zjlx"] != null && dt.Rows[n]["zjlx"].ToString() != "")
                    {
                        model.zjlx = dt.Rows[n]["zjlx"].ToString();
                    }
                    if (dt.Rows[n]["zjhm"] != null && dt.Rows[n]["zjhm"].ToString() != "")
                    {
                        model.zjhm = dt.Rows[n]["zjhm"].ToString();
                    }
                    if (dt.Rows[n]["sfzh"] != null && dt.Rows[n]["sfzh"].ToString() != "")
                    {
                        model.sfzh = dt.Rows[n]["sfzh"].ToString();
                    }
                    if (dt.Rows[n]["bxlb"] != null && dt.Rows[n]["bxlb"].ToString() != "")
                    {
                        model.bxlb = dt.Rows[n]["bxlb"].ToString();
                    }
                    if (dt.Rows[n]["bxh"] != null && dt.Rows[n]["bxh"].ToString() != "")
                    {
                        model.bxh = dt.Rows[n]["bxh"].ToString();
                    }
                    if (dt.Rows[n]["jzdzs"] != null && dt.Rows[n]["jzdzs"].ToString() != "")
                    {
                        model.jzdzs = dt.Rows[n]["jzdzs"].ToString();
                    }
                    if (dt.Rows[n]["jzdzs1"] != null && dt.Rows[n]["jzdzs1"].ToString() != "")
                    {
                        model.jzdzs1 = dt.Rows[n]["jzdzs1"].ToString();
                    }
                    if (dt.Rows[n]["jzdzx"] != null && dt.Rows[n]["jzdzx"].ToString() != "")
                    {
                        model.jzdzx = dt.Rows[n]["jzdzx"].ToString();
                    }
                    if (dt.Rows[n]["jzdzjdz"] != null && dt.Rows[n]["jzdzjdz"].ToString() != "")
                    {
                        model.jzdzjdz = dt.Rows[n]["jzdzjdz"].ToString();
                    }
                    if (dt.Rows[n]["jzdzsqc"] != null && dt.Rows[n]["jzdzsqc"].ToString() != "")
                    {
                        model.jzdzsqc = dt.Rows[n]["jzdzsqc"].ToString();
                    }
                    if (dt.Rows[n]["xqlm"] != null && dt.Rows[n]["xqlm"].ToString() != "")
                    {
                        model.xqlm = dt.Rows[n]["xqlm"].ToString();
                    }
                    if (dt.Rows[n]["nm"] != null && dt.Rows[n]["nm"].ToString() != "")
                    {
                        model.nm = dt.Rows[n]["nm"].ToString();
                    }
                    if (dt.Rows[n]["hm"] != null && dt.Rows[n]["hm"].ToString() != "")
                    {
                        model.hm = dt.Rows[n]["hm"].ToString();
                    }
                    if (dt.Rows[n]["fjm"] != null && dt.Rows[n]["fjm"].ToString() != "")
                    {
                        model.fjm = dt.Rows[n]["fjm"].ToString();
                    }
                    if (dt.Rows[n]["字段28"] != null && dt.Rows[n]["字段28"].ToString() != "")
                    {
                        model.字段28 = int.Parse(dt.Rows[n]["字段28"].ToString());
                    }
                    if (dt.Rows[n]["zrys"] != null && dt.Rows[n]["zrys"].ToString() != "")
                    {
                        model.zrys = dt.Rows[n]["zrys"].ToString();
                    }
                    if (dt.Rows[n]["jdr"] != null && dt.Rows[n]["jdr"].ToString() != "")
                    {
                        model.jdr = dt.Rows[n]["jdr"].ToString();
                    }
                    if (dt.Rows[n]["jdjg"] != null && dt.Rows[n]["jdjg"].ToString() != "")
                    {
                        model.jdjg = dt.Rows[n]["jdjg"].ToString();
                    }
                    if (dt.Rows[n]["gljg"] != null && dt.Rows[n]["gljg"].ToString() != "")
                    {
                        model.gljg = dt.Rows[n]["gljg"].ToString();
                    }
                    if (dt.Rows[n]["glfwz"] != null && dt.Rows[n]["glfwz"].ToString() != "")
                    {
                        model.glfwz = dt.Rows[n]["glfwz"].ToString();
                    }
                    if (dt.Rows[n]["jdsj"] != null && dt.Rows[n]["jdsj"].ToString() != "")
                    {
                        model.jdsj = DateTime.Parse(dt.Rows[n]["jdsj"].ToString());
                    }
                    if (dt.Rows[n]["dazt"] != null && dt.Rows[n]["dazt"].ToString() != "")
                    {
                        model.dazt = dt.Rows[n]["dazt"].ToString();
                    }
                    if (dt.Rows[n]["daly"] != null && dt.Rows[n]["daly"].ToString() != "")
                    {
                        model.daly = dt.Rows[n]["daly"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return modelList;
        }
		#endregion  Method
	}
}

